package com.chendx.store.user.controller;

import com.chendx.model.common.dtos.ResponseResult;
import com.chendx.model.user.dto.LoginDto;
import com.chendx.store.api.user.LoginControllerApi;
import com.chendx.store.user.service.UserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by chendx on 2022/4/26.
 */
@RestController
@RequestMapping("/api/login")
public class LoginController implements LoginControllerApi {


    @Autowired
    private UserLoginService loginService;

    @PostMapping("/login_auth")
    @Override
    public ResponseResult login(@RequestBody LoginDto dto) {
        return loginService.login(dto);
    }

    @Override
    public ResponseResult existPhone(String phone) {
        return null;
    }

    @Override
    public ResponseResult existName(String name) {
        return null;
    }

    @Override
    @PostMapping("/verfi_code")
    public ResponseResult verficationCode(@RequestBody LoginDto dto) {
        return loginService.verficationCode(dto);
    }

    @Override
    @GetMapping("/check_code")
    public Boolean checkvCode(String phone,String code) {
        return loginService.checkvCode(phone,code);
    }
}
